home *** CD-ROM | disk | FTP | other *** search
- Path: colossus.holonet.net!russell
- From: russell@news.mdli.com (Russell Blackadar)
- Newsgroups: comp.lang.c++
- Subject: Re: maddening constructor problem
- Date: 21 Jan 1996 21:52:13 GMT
- Organization: HoloNet National Internet Access System: 510-704-1058/modem
- Message-ID: <4ducid$l3j@colossus.holonet.net>
- References: <4dr307$4so@noc2.drexel.edu>
- NNTP-Posting-Host: jubal.mdli.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- Jonathan Juniman (st918h5w@dunx1.ocs.drexel.edu) wrote:
- : Maddening constructor problem:
-
- : MYCLASS.H
- : class MyClass
- : {
- : public:
- : MyClass(unsigned int i, insigned int j, double* pK);
- : // etc
- : }
- ^ PUT A SEMICOLON HERE!!
-
- : MYCLASS.CPP
- : MyClass::MyClass(unsigned int i, unsigned int j, double* pK)
- : {
- : // constructor code here
- : }
-
- : Visual C++ bites me on MYCLASS.CPP, saying "constructor not allowed
- : a return type". What's the problem? The constructor doesn't _have_
- : a return type. Please respond by e-mail.
-
- I assume the first line of MYCLASS.CPP is #include "myclass.h" --
- if not, you should add this line. Then, add the semicolon to your
- class definition and all should be fine.
-
- Because of the missing semicolon, the function definition is part
- of the same statement as your class definition. Syntactically, you
- are saying the function's return type is a MyClass object.
- --
- Russell Blackadar, russell@mdli.com
-